package cn.wen233.spring.discovery;

import cn.wen233.basic.model.Instance;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;

import java.net.URI;
import java.util.Map;

/**
 * Instance
 *
 * @author wenei
 * @date 2021-10-26 19:42
 */
public class SunglowServiceInstance extends Instance implements ServiceInstance {

    public SunglowServiceInstance(Instance instance) {
        super(instance);
    }

    @Override
    public String getServiceId() {
        return super.getServiceName();
    }

    @Override
    public String getHost() {
        return super.getIp();
    }

    @Override
    public int getPort() {
        return super.getPort();
    }

    @Override
    public boolean isSecure() {
        return false;
    }

    @Override
    public URI getUri() {
        return DefaultServiceInstance.getUri(this);
    }

    @Override
    public Map<String, String> getMetadata() {
        return null;
    }
}
